// node 5_对象的属性值.js

//对象的属性值有：字符串 和 Symbol 两种

//代码段1
//非字符会被转换为字符
var a={},b="123",c=123
a[b] = 'b'
a[c] = 'c'
console.log(a[b])
//a.123 = 'b'
//a.123 = 'c'

//代码段2
//Symbol符号是独一无二的
var a={},b=Symbol('123'),c=Symbol('123')
a[b] = 'b'
a[c] = 'c'
console.log(a[b])
//a.Symbol('123') = 'b'
//a.Symbol('123') = 'c'
// Symbol('123') != Symbol('123')

//代码段3
//对象会被执行toString()转字符串
//对象执行toString()结果为[object Object]
var a={},b={key:'123'},c={key:'456'}
a[b] = 'b'
a[c] = 'c'
console.log(a[b])
//a.[object Object] = 'b'
//a.[object Object] = 'c'